package com.tianbao54.kotlin_01

/**
 * 数组及遍历
 */
fun main(args: Array<String>) {

    var array: IntArray = intArrayOf(3, 5, 1, 2, 7)
    array.forEach { println(it) }
    println("===================")
    for (item in array) {
        println(item)
    }

    println("===================")
    for (i in array.indices) {
        println("array[$i] = ${array[i]}")
    }
    println("===================")
    for ((index ,value) in array.withIndex()) {
        println("array[$index] = $value")
    }
}